home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / mib / mibTextBig.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  2.9 KB  |  126 lines

  1. #include "mibload.h"
  2. #include "mibwidgets.h"
  3.  
  4. extern Display    *dpy;
  5. extern GC    mib_gc;
  6.  
  7. /* Code of TextBig */
  8. /*****************************************************************************/
  9.  
  10. mib_Widget *mib_create_TextBig(mib_Widget *parent, char *name, char *label,
  11.         int posx, int posy, int width, int height, int mib_fill)
  12. {
  13.   mib_Widget    *temp;
  14.   mib_TextBig    *myres;
  15.   Widget     wtemp;
  16.   Arg         args[20];
  17.   int         n;
  18.  
  19.   /* create the new widget and add it to the tree */
  20.  
  21.   temp = mib_new_mib_Widget();
  22.   if (mib_fill == WDEFAULT)
  23.     mib_add_backward(temp, parent);
  24.   else
  25.     mib_add_mib_Widget(temp, parent);
  26.  
  27.   myres = (mib_TextBig *)malloc(sizeof(mib_TextBig));
  28.  
  29.   /* initialize public resources */
  30.  
  31.   if (mib_fill == WDEFAULT)
  32.   {
  33.     temp->name = (char *)malloc(strlen(name)+1);
  34.     strcpy(temp->name,name);
  35.   }
  36.   temp->mib_class = (char *)malloc(8);
  37.   sprintf(temp->mib_class,"TextBig");
  38.   temp->mib_class_num = MIB_TEXTBIG;
  39.   temp->width = width;
  40.   temp->height = height;
  41.   temp->topOffset = posy;
  42.   temp->leftOffset = posx;
  43.   temp->bottomOffset = 0;
  44.   temp->rightOffset = 0;
  45.   temp->topAttachment = 1;
  46.   temp->leftAttachment = 1;
  47.   temp->bottomAttachment = 0;
  48.   temp->rightAttachment = 0;
  49.  
  50.   temp->mib_allowresize = 1;
  51.  
  52.   /* initialize private resources */
  53.  
  54.   temp->myres = (void *)myres;
  55.   myres->nothing = 0;
  56.  
  57.   /* create Xt widget */
  58.  
  59.   n = 0;
  60.  
  61.   if (mib_fill == WDEFAULT)
  62.   {
  63.     XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++;
  64.     XtSetArg (args[n], XmNleftOffset, posx);n++;
  65.     XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++;
  66.     XtSetArg (args[n], XmNtopOffset, posy);n++;
  67.   }
  68.   XtSetArg (args[n], XmNrubberPositioning, False); n++;
  69.   XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_IN); n++;
  70.  
  71.   temp->me = XtCreateManagedWidget(name, xmFrameWidgetClass,
  72.                 temp->parent->me, args, n);
  73.  
  74.   n = 0;
  75.  
  76.   if (mib_fill == WDEFAULT)
  77.   {
  78.     XtSetArg (args[n], XmNwidth, width); n++;
  79.     XtSetArg (args[n], XmNheight, height); n++;
  80.     XtSetArg (args[n], XmNrows, 200); n++;
  81.     XtSetArg (args[n], XmNcolumns, 200); n++;
  82.   }
  83.   XtSetArg (args[n], XmNrubberPositioning, False); n++;
  84.   XtSetArg (args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
  85.   XtSetArg (args[n], XmNhighlightThickness, 0); n++;
  86.  
  87.   wtemp = XmCreateScrolledText(temp->me, name, args, n);
  88.  
  89.   XtManageChild(wtemp);
  90.  
  91.   if (mib_fill == WEDIT || mib_fill == WDEFAULT)
  92.   {
  93.     XmTextSetString(wtemp,"Big Text Field\nwith Scrollbars\n\n\n\n\n\n\n ");
  94.  
  95.     mib_apply_eventhandlers(wtemp, temp);
  96.     mib_apply_eventhandlers(temp->me, temp);
  97.   }
  98.  
  99.   return temp;
  100. }
  101.  
  102. void mib_delete_TextBig(mib_Widget *this)
  103. {
  104.   mib_TextBig *temp = (mib_TextBig *)this->myres;
  105.  
  106.   free(temp);
  107. }
  108.  
  109. void mib_save_TextBig(mib_Widget *this, FILE *fout)
  110. {
  111. }
  112.  
  113. int mib_load_TextBig(mib_Widget *this, mib_Buffer *fin)
  114. {
  115.   char          res[MI_MAXSTRLEN];
  116.   char          val[MI_MAXSTRLEN];
  117.  
  118.   if (!mib_read_line(fin, res, val))
  119.     return 0;
  120.  
  121.   if (strcmp(res,"EndWidget"))
  122.     return 0;
  123.  
  124.   return 1;
  125. }
  126.